package com.qf.edu.dao.impl;

import com.qf.edu.dao.PatSign;
import com.qf.edu.entity.PatientSign;
import com.qf.edu.utils.DBUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @author:huayuzhuo
 * @email:2798866329@qq.com
 * @desc:
 * @datatime: 2022/5/25 9:06
 */
public class PatSignImpl implements PatSign {
    @Override
    public int patienSi(PatientSign patientSign) {
        QueryRunner queryRunner = new QueryRunner(DBUtils.getDataSource());
        String sql = "INSERT INTO patientsign (idNumber,`name`,drugName,heat,rate,pressure,glucose,remark) VALUES (?,?,?,?,?,?,?,?)";

        try {
            int update = queryRunner.update(sql, new Object[]{patientSign.getIdNumber(),patientSign.getName(), patientSign.getDrugName(), patientSign.getHeat(), patientSign.getRate(), patientSign.getPressure(), patientSign.getGlucose(), patientSign.getRemark()});
            return update;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return 0;
    }
}
